<template>
  <view>
    <view class="goods-item">
      <!-- 左边图片 -->
      <view class="goods-item-left">
        <image class="img1" :src="goods.goods_small_logo||defaultPic" mode="widthFix"></image>
      </view>
      <!-- 左边图片 -->
      <!-- 右边详情 -->
      <view class="goods-item-right">
        <view class="goods-name">{{goods.goods_name}}</view>
        <view class="goods-price">￥{{goods.goods_price | tofixed}}</view>
      </view>
      <!-- 右边详情 -->
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-goods",
    // 定义 props 属性，用来接收外界传递到当前组件的数据
        props: {
          // 商品的信息对象
          goods: {
            type: Object,
            default:{}
          },
        },
    data() {
      return {
         defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
      }
    },
    filters:{
     tofixed(num){
       return Number(num).toFixed(2)
     } 
    },
    methods: {
      
    }
  }
</script>

<style lang="scss">
  .goods-item{
    display: flex;
    padding: 5px 5px;
    border-bottom: 1px solid #ccc;
    .goods-item-left{
      margin-right: 5px;
      .img1{
        width: 100px;
      }
    }
    .goods-item-right{
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .goods-name{
        font-size: 13px;
      }
      .goods-price{
        font-size: 16px;
        color: #c00000;
      }
    }
  }
</style>
